package 双指针.盛最多水的容器;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 25228
 * Date: 2025-03-03
 * Time: 19:06
 */
public class my {
    public static void main(String[] args) {
        int[] array={1,8,6,2,5,4,8,3,7};
        int a=0;
        int b=array.length-1;
        int max=0;
        while (a!=b){
            int max2=Math.min(array[a],array[b])*(b-a);
            if (max2>max){
                max=max2;
            }
            if (array[a]<array[b]){
                a++;
            }else {
                b--;
            }
        }
        System.out.println(max);
    }
}
